package com.niuxiaofa.newlaw.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.recyclerview.widget.RecyclerView;

import com.niuxiaofa.newlaw.Bean.NewOrderBean;
import com.niuxiaofa.newlaw.R;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class NoticeAdapter extends RecyclerView.Adapter<NoticeAdapter.BaseViewHolder> {

    List<NewOrderBean.DataDTO.RecordsDTO> dtoList;


    public NoticeAdapter(List<NewOrderBean.DataDTO.RecordsDTO> list) {
        this.dtoList=list;
    }

    @Override
    public BaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.widget_scroll_text_layout, parent, false);
        BaseViewHolder holder = new BaseViewHolder(view);
        return holder;
    }

    @Override
    public void onBindViewHolder(BaseViewHolder holder, int position) {
        position=position%2;
        if (dtoList.size()>0) {
            holder.textstring1.setText(dtoList.get(position).getDescription());
            holder.textstring2.setText(dtoList.get(position).getDescription());
        }
    }

    @Override
    public int getItemCount() {
        return Integer.MAX_VALUE;
    }

    class BaseViewHolder extends RecyclerView.ViewHolder {

        @BindView(R.id.textstring1)
        TextView textstring1;

        @BindView(R.id.textstring2)
        TextView textstring2;



        public BaseViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }

}
